/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.team1160.beta.season2011.input.RoboModel;

import java.util.Vector;

/**
 * This model holds all the information regarding the robot from interation
 * to interation
 * @author CJ
 */
public class Model {
    public static final int JOYSTICK_Y_AXIS=1;
    public static final int JOYSTICK_Z_AXIS=2;

    Vector listeners;
    double[] data;

    public void addModelListener(ModelListener l){
        this.listeners.addElement(l);
    }

    public void setJoyYAxis(double value){
        this.data[Model.JOYSTICK_Y_AXIS]=value;
        for(int i=0;i<listeners.size();i++){
            ((ModelListener) listeners.elementAt(i)).onDriveTrainChange(
                    new DriveTrainModelEvent(value,Model.JOYSTICK_Y_AXIS));
        }
    }

    public void setJoyZAxis(double value){
        this.data[Model.JOYSTICK_Z_AXIS]=value;
        for(int i=0;i<listeners.size();i++){
            ((ModelListener) listeners.elementAt(i)).onDriveTrainChange(
                    new DriveTrainModelEvent(value,Model.JOYSTICK_Z_AXIS));
        }
    }
}
